fix(script-tool): force color off in captured script output (deterministic)#108
Merged
Conversation
…istic) The script tool's subprocess stdout is CAPTURED — parsed by the loop and matched in tests — never shown live in a terminal, so ANSI colorization is corruption, not presentation. Bun colorizes console.log values (a numeric `403` becomes \x1b[33m403\x1b[0m) whenever it detects color support, so captured output differed between CI (no TTY, plain) and a local TTY (colored): script-tool's wrong-token test asserts a literal 'STATUS 403' and passed in CI but broke under the local pre-push hook. Set NO_COLOR=1 / FORCE_COLOR=0 in the script subprocess env so captured output is plain and stable everywhere.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The script tool's subprocess stdout is captured — parsed by the loop and matched in tests — never shown live in a terminal, so ANSI colorization is corruption, not presentation. Bun colorizes
console.logvalues (a numeric403→\x1b[33m403\x1b[0m) whenever it detects color support, so captured output differed between CI (no TTY → plain) and a local TTY (colored). A script-tool test asserting a literalSTATUS 403passed in CI but broke under the local pre-push hook.Fix
Set
NO_COLOR=1/FORCE_COLOR=0in the script subprocess env so captured output is plain and stable everywhere.Test
New regression test forces
FORCE_COLOR=1in the parent env and asserts the captured output ofconsole.log(403)contains no ESC byte and still contains403.Reviewer panel: PASS. Full
bun run validategreen.